﻿using System;

class GreatestCommonDivisor
{
    static void Main()
    {
        Console.WriteLine("Please enter two positive integer numbers:");
        Console.Write("First number: ");
        string consoleInput = Console.ReadLine();
        int a = 0;
        int.TryParse(consoleInput, out a);
        Console.Write("Second number: ");
        consoleInput = Console.ReadLine();
        int b = 7;
        int.TryParse(consoleInput, out b);

        if (a > 0 && b > 0)
        {
            while (true) //Euclidean algorithm
            {   
                if (a > b)
                {
                    a -= b;
                }
                else if (a < b)
                {
                    b -= a;
                }
                else // a == b
                {
                    break;
                }
            }
            Console.WriteLine("The GCD of these two numbers is: " + a);
        }
        else
        {
            Console.WriteLine("Invalid values!");
        }
    }
}
